<%@page import="com.mbbmap.util.EncryptionHelper"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="com.mbbmap.util.EncryptionHelper"%>
<%@ page import = "java.util.TreeMap, java.util.LinkedHashMap, com.classes.Casemast" %>
<%
TreeMap<String, String> viewAccess = (TreeMap<String, String>) request.getAttribute("view_access");

LinkedHashMap<String, String> tabs = new LinkedHashMap<String, String>();
tabs.put("application", "<a href='javascript:tab.load(\"/NewApp.do?dispatch=init\")'>Application Input / Information</a>");
tabs.put("recommendation", "<a href='javascript:tab.load(\"/NewApp.do?dispatch=recom_approval\")'>Recommendation / Approval</a>");
tabs.put("document", "<a href='javascript:tab.load(\"/NewApp.do?dispatch=supporting_document\")'>Documents</a>");
tabs.put("vendor","<a href='javascript:tab.load(\"/NewApp.do?dispatch=vendor_pos\")'>Vendor</a>");

String html = "<ul class=\"nav nav-tabs top_tab\">";

if(request.getAttribute("m_case") != null){
	Casemast m_case = (Casemast) request.getAttribute("m_case");
	
	html += "<li class=\"ref_no\"><span>" + m_case.getReferenceNo() + "</span></li>";
	html += "<li class=\"ref_no print\"><a class=\"btn\" href=\"javascript:merchant.print_case('" + EncryptionHelper.encrypt(m_case.getMerchant().getId()+"") + "', '" + EncryptionHelper.encrypt(m_case.getId()+"") + "')\">PRINT CASE</a></li>";
	html += "<li class=\"ref_no duplicate\"><a class=\"btn\" href=\"javascript:merchant.duplicate_case('" + EncryptionHelper.encrypt(m_case.getId()+"") + "')\">DUPLICATE CASE</a></li>";
}

for(String s : tabs.keySet()){
	if(viewAccess.containsKey("tab_" + s)){
		if(viewAccess.get("tab_" + s).equals("read") || viewAccess.get("tab_" + s).equals("edit")){
			html += "<li id=\"" + s + "\">" + tabs.get(s) +  "</li>";
		}
	} else {
		html += "<li id=\"" + s + "\">" + tabs.get(s) + "</li>";
	}
}

html += "</ul>";
html = html.replace("<li id=\"" + EncryptionHelper.decrypt(request.getParameter("active")) + "\">", "<li id=\"" + EncryptionHelper.decrypt(request.getParameter("active")) + "\" class=\"active\">");
out.println(html);
%>